package com.loubii.sunshineSchool.ui.avtivity;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.loubii.sunshineSchool.R;
import com.loubii.sunshineSchool.adapter.BaseRecycleAdapter;
import com.loubii.sunshineSchool.adapter.SSCardAdapter;
import com.loubii.sunshineSchool.httpRequest.HttpBin;
import com.loubii.sunshineSchool.pojo.ActivityContainer;

import butterknife.BindView;
import retrofit2.Call;
import retrofit2.Response;

public class SSHistoryActivity extends BaseToolBarActivity {

    @BindView(R.id.rv_card1)
    RecyclerView mRvCard;
    private SSCardAdapter mAdapter;

    @Override
    protected void initData() {
        HttpBin.findMyActivity(this, new HttpBin.ResponseListener<ActivityContainer>() {

            @Override
            public void onResponse(Call<ActivityContainer> call, Response<ActivityContainer> response) {
                mAdapter.setData(response.body());
            }

            @Override
            public void onFailure(Call<ActivityContainer> call, Throwable t) {

            }
        });
    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_balance;
    }

    @Override
    protected void initView() {
        setTitle("历史发布");
        initRecycleView();
        mAdapter.setOnItemClickListener(new BaseRecycleAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, int position) {

            }
        });
    }

    private void initRecycleView() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        mRvCard.setLayoutManager(linearLayoutManager);
        mAdapter = new SSCardAdapter(this);
        mRvCard.setAdapter(mAdapter);
    }
}
